<?php
namespace Home\Controller;
use Think\Controller;
class BasicController extends Controller {
	 /**
     * 管理员列表
     */
    public function index() {
        //使用D调用视图模型
        $basic = M('basic');
		if(IS_POST){
			$id = I('post.id',0,'int');
			$data['number'] = I('post.number','','int');
			$data['page_num'] = I('post.page_num','','int');
			//var_dump($_POST);exit;
			if($basic->create()) {
				if($basic->where('id='.$id)->save($data) !== false) {
					$this->success('编辑成功',U('Basic/index'));
				}else {
					$this->error('编辑失败',U('Basic/index'));
				}
			}else {
				$this->error($basic->getError());
			}
		}else{
			$data = $basic->find();
			$this->assign('data',$data);
			$this->display();	
		}
    }
}